

<%@ page import="sedh.project.User"%>
<html>
	<head>
        <g:render template="/header"/>
    </head>
    <body>
    <g:render template="/informationBar"/>
    
    <g:render template="/menu"/>
        
	<div class="body">
		<h1>Criar Novo Usuario</h1>
		<g:if test="${flash.message}">
			<div class="message">
				${flash.message}
			</div>
		</g:if>
		<g:hasErrors bean="${userInstance}">
			<div class="errors">
				<g:renderErrors bean="${userInstance}" as="list" />
			</div>
		</g:hasErrors>
		<g:form action="save">
			<div class="dialog">
				<table>
					<tbody>

						<tr class="prop">
							<td valign="top" class="name"><label for="nome"><g:message
										code="user.nome.label" default="Nome:" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: userInstance, field: 'nome', 'errors')}">
								<g:textField name="nome" maxlength="30"
									value="${userInstance?.nome}" />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="municipio"><g:message
										code="user.municipio.label" default="Municipio:" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: userInstance, field: 'municipio', 'errors')}">
								<g:textField name="municipio"
									value="${fieldValue(bean: userInstance, field: 'municipio')}" />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="papel"><g:message
										code="user.papel.label" default="Papel:" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: userInstance, field: 'papel', 'errors')}">
								<g:select id="papelSelection" name="papel"
									from="${sedhproject.Papel}" value=""
									noSelection="['':'Selecionar...']" />
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="telefone"><g:message
										code="user.telefone.label" default="Telefone:" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: userInstance, field: 'telefone', 'errors')}">
								<g:textField name="telefone"
									value="${fieldValue(bean: userInstance, field: 'telefone')}" />
								<p>*Digite apenas os numeros.</p>
							</td>
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="email"><g:message
										code="user.email.label" default="Email" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: userInstance, field: 'email', 'errors')}">
								<g:textField name="email"
									value="${userInstance?.email}" />
								
							</td>
						</tr>
						
						<tr class="prop">
							<td valign="top" class="name"><label for="rg"><g:message
										code="user.rg.label" default="Rg:" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: userInstance, field: 'rg', 'errors')}">
								<g:textField name="rg"
									value="${userInstance?.rg}" />
								<p>*Digite apenas os numeros.</p>	
								<br></br>
							</td>
							
						</tr>

						<tr class="prop">
							<td valign="top" class="name"><label for="username"><g:message
										code="user.username.label" default="Seu login:" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: userInstance, field: 'username', 'errors')}">
								<g:textField name="username"
									value="${userInstance?.rg}" />
							</td>
							
						</tr>
						
						<tr class="prop">
							<td valign="top" class="name"><label for="password"><g:message
										code="user.password.label" default="Sua senha:" /> </label>
							</td>
							<td valign="top"
								class="value ${hasErrors(bean: userInstance, field: 'password', 'errors')}">
								<g:passwordField name="password"
									value="${userInstance?.password}" />
							</td>
							
						</tr>
						
					</tbody>
					
				</table>
			</div>
			<div class="buttons">
				<span class="button"><g:submitButton name="create"
						class="save"
						value="${message(code: 'default.button.create.label', default: 'Criar Usuario')}" />
				</span>
			</div>
		</g:form>
	</div>
</body>
</html>
